<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>window_top属性演示文档</title>
    <script>
      function check() {
        if (window.top != window.self) {
          document.write("<p>这个窗口不是最顶层窗口!我在一个框架里面!</p>");
        } else {
          document.write("<p>这个窗口是最顶层窗口!</p>");
        }
      }
    </script>
  </head>
  <body>
    <button type="button" onclick="check()">检查当前窗口是否在框架内</button>
  </body>
</html>
